﻿using UnityEngine;

namespace Assets.Scripts.Interface
{
    class MainMenuInterface : InterfaceBase
    {
        private bool ChangeScene;
        private bool ShowCredits;
        private GameObject Credits;

        void Awake()
        {
            Credits = this.gameObject.transform.parent.FindChild("Credits").gameObject;
        }

        void OnEnable()
        {
            base.OnEnable();
            ChangeScene = ShowCredits = false;
        }

        protected override void Execute()
        {
            if (ChangeScene)
                Application.LoadLevel("IntroScene");
            else
                Credits.SetActive(true);

            this.gameObject.SetActive(false);
        }

        public void OnNewGameClick()
        {
            ChangeScene = ButtonClick();
        }

        public void OnCreditsClick()
        {
            ShowCredits = ButtonClick();
        }

        public void OnExitClick()
        {
            Application.Quit();
        }
    }
}
